import pinia from '@/store'
import { useUserStore } from '@/store/module/user'

const userStore = useUserStore(pinia)

// 按钮是否显示的自定义指令
export const IsHasButton = (app: any) => {
  app.directive('has', {
    mounted(el: any, binding: any) {
      if (!userStore.buttons?.includes(binding.value)) {
        el.parentNode.removeChild(el)
      }
    }
  })
}
